import { http } from "@/utils/http";
import type { FormItemProps } from "@/views/system/menu/utils/type";

const modulePath = "/system";

export type MenusResul = {
  success: boolean;
  message: string;
  data: Object;
};

/** 新增 */
export const menusAdd = (data?: FormItemProps) => {
  return http.request<MenusResul>("post", modulePath + "/menus/add", { data });
};

/** 修改 */
export const menusUpdate = (data?: FormItemProps) => {
  return http.request<MenusResul>("put", modulePath + "/menus/update", {
    data
  });
};

/** 删除 */
export const menusDelete = (data: Object) => {
  return http.request<MenusResul>("delete", modulePath + "/menus/delete", {
    data
  });
};

/** 详情 */
export const menusDetails = (data: Object) => {
  return http.request<MenusResul>("get", modulePath + "/menus/details", {
    data
  });
};

/** 获取所有列表 */
export const menusGetAllList = () => {
  return http.request<MenusResul>("get", modulePath + "/menus/all", {});
};

/** 获取分页列表 */
export const menusGetList = (data: Object) => {
  return http.request<MenusResul>("get", modulePath + "/menus/list", { data });
};
